<?php
use yii\widgets\LinkPager;
use yii\helpers\Url;
$this->title = '拍卖中心';
?>
<style type="text/css">
    .pig_item_div{float:left;width: 180px; height: 260px;margin:8px 8px; position: relative;}
    .pig_item_div img{padding:15px 10px;}
    .pig_algebra{position: absolute; left: 150px; top: 10px;font-size: 16px; font-weight: bold; color: #70DB93}
    .pig_algebra font{font-size: 15px;padding-left: 2px; font-weight: normal}
    .pig_price{position: absolute;left: 60px; top: 235px;color: #FF7F00;font-weight: bold;font-size: 14px;}
    .pig_att{position: absolute; left: 20px; top: 210px}
    .select-gen{width: 50px;}
    .form-search{padding-top: 10px}
</style>
<div class="site-index">
<?php echo $this->render('/public/top'); ?>
    <div class="col-lg-6" style="float: left; width: 100%; margin:10px 0px;">
        <div class="col-lg-5">
            <p>
                <a href="#search-show" class="btn"  role="button" data-toggle="modal">高级搜索</a>
                <?php echo $sortUrl;?>
            </p>
            <div id="search-show" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h3 id="myModalLabel">高级搜索</h3>
                </div>
                <form class="form-search form-horizontal" action="/pet/list" method="post">
                    <div class="control-group">
                        <label class="control-label" for="inputEmail">代数：</label>
                        <div class="controls">
                            <select class="select-gen" name="algebra">
                                <option value="1"<?php if(Yii::$app->request->post('algebra') == 1):?>selected<?php endif;?>>1</option>
                                <option value="2"<?php if(Yii::$app->request->post('algebra') == 2):?>selected<?php endif;?>>2</option>
                                <option value="3"<?php if(Yii::$app->request->post('algebra') == 3):?>selected<?php endif;?>>3</option>
                                <option value="4"<?php if(Yii::$app->request->post('algebra') == 4):?>selected<?php endif;?>>4</option>
                                <option value="5"<?php if(Yii::$app->request->post('algebra') == 5):?>selected<?php endif;?>>5</option>
                                <option value="6"<?php if(Yii::$app->request->post('algebra') == 6):?>selected<?php endif;?>>6</option>
                            </select>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="inputEmail">掘金：</label>
                        <div class="controls">
                            <input type="text" name="nuggets_min" class="select-gen" value="<?php echo Yii::$app->request->post('nuggets_min')?>">
                            &nbsp; - &nbsp;
                            <input type="text" name="nuggets_max" class="select-gen" value="<?php echo Yii::$app->request->post('nuggets_max')?>">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="inputEmail">成长值：</label>
                        <div class="controls">
                            <input type="text" name="grow_min" class="select-gen" value="<?php echo Yii::$app->request->post('grow_min')?>">&nbsp; - &nbsp;
                            <input type="text" name="grow_max" class="select-gen" value="<?php echo Yii::$app->request->post('grow_max')?>">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="inputEmail">体重：</label>
                        <div class="controls">
                            <input type="text" name="height_min" class="select-gen" value="<?php echo Yii::$app->request->post('height_min')?>">&nbsp; - &nbsp;
                            <input type="text" name="height_max" class="select-gen" value="<?php echo Yii::$app->request->post('height_max')?>">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="inputEmail"></label>
                        <div class="controls">
                            <button type="submit" class="btn">搜索</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <?php if (!empty($list)):?>
        <?php foreach ($list as $key => $item):?>
        <div class="pig_item_div pig-bg<?php echo $item->pet->getPetBack()?>">
            <a href="/pet/hang-detail?pid=<?php echo $item->pet->pid?>&user_id=<?php echo $item->user_id?>">
                <img src="/images/pig/p<?php echo $item->pet->style?>.svg" width="140">
            </a>
            <div class="pig_algebra">
                <?php echo $item->pet->algebra?><font>代</font>
            </div>
            <div class="pig_att">
                <?php echo $item->pet->grow.'/'.$item->pet->nuggets?> · <?php echo $item->pet->height?> kg
            </div>
            <div class="pig_price">
                <?php echo $item->price?> wkc
            </div>
        </div>
        <?php endforeach;?>
        <?php else:?>
        暂无数据
        <?php endif;?>
        <div class="pagination">
        <?= LinkPager::widget([
            'pagination' => $pages,
            'nextPageLabel' => '下一页',
            'prevPageLabel' => '上一页',
            'firstPageLabel' => '首页',
            'lastPageLabel' => '尾页',
        ]); ?>
        </div>
    </div>
</div>
